package org.andengine.bulletml.simple;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.simpleframework.xml.*;

@Root (name = "boss")
public class BossData {
	
	@Attribute
	private int health;
	
	@Attribute
	private String actMode; //Simultaneously or Alternating.
	
	@Attribute
	private String hasCore;
	
	@ElementList (required = false)
	private LinkedList<Action> actions = new LinkedList<Action>();
	
	@ElementList (required = false)
	private LinkedList<ActionSeq> actSeqs = new LinkedList<ActionSeq>();
	
	@ElementMap (entry ="entry", key="hp%", value = "mod", required = false)
	private Map<Float, Float> timeMods = new HashMap<Float,Float>();
	
	@ElementMap (entry ="entry", key="hp%", value = "mod", required = false)
	private Map<Float, Float> atkMods = new HashMap<Float,Float>();
	
	@Element (required = false)
	private float seqRecov = 0.0f;

	@Element (name = "vx", required = false)
	private float vX = 0;
	
	@Element (name = "vy", required = false)
	private float vY = 0;
	
	@Element (name = "baseDef", required = false)
	private float defMod = 1; //The higher this number is, the more damage they take. It's a multiplier.
	
	public final boolean hasCore() {
		return hasCore.equalsIgnoreCase("true");
	}

	public final List<Action> getActions() {
		return actions;
	}
	
	public final int numActions(){
		return actions.size();
	}
	
	public String toString(){
		String out = "Health: " + getHealth() + "\nActions:\n";
		for(Action a: this.actions){
			out += a.toString();
		}
		return out;
	}

	public final boolean hasSequences(){
		return actSeqs.isEmpty();
	}

	public final List<ActionSeq> getSequences() {
		return actSeqs;
	}

	public final float getSeqRecov() {
		return this.seqRecov;
	}

	public final float getvX() {
		return this.vX;
	}

	public final float getvY() {
		return this.vY;
	}
	
	public final float getvMag(){
		return (float) Math.sqrt((this.vX*this.vX) + (this.vY*this.vY));
	}

	public final int getHealth() {
		return this.health;
	}

	public final String getActMode() {
		return this.actMode;
	}

	public float getDefMod() {
		return defMod;
	}

	public Map<Float, Float> getTimeMods() {
		return timeMods;
	}

	public Map<Float, Float> getAtkMods() {
		return atkMods;
	}
}
